package com.zhou.utils;


import lombok.extern.slf4j.Slf4j;

/**
 * 这是一个工具类，用来存贮通过token获取到的用户id
 * @author zhouyuyan
 */
@Slf4j
public class ThreadLocalUtil {
    /**
     * 创建一个对象
     */
    private static ThreadLocal<String> threadLocal=new ThreadLocal<>();

    public static void setId(String id){
        log.info("线程id为：{}",id);
        threadLocal.set(id);
    }
    public static String  getId(){
        log.info("线程id为：{}",threadLocal.get());
        return threadLocal.get();
    }
}
